import { http } from "@/utils/http";

type ResultTable = {
  total?: number;
  data?: Array<any>;
};

//自动抄表 查询
export const balancequeryReadingList = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/queryReadingListV2`, {
    data
  });
};

//自动抄表 修正
export const balanceupdateReading = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/updateReading`, {
    data
  });
};

//提交记录 新增
export const balanceaddSubmitHistory = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/addSubmitHistory`, {
    data
  });
};

//自动抄表 查询修正历史记录
export const queryReadingModifyHistory = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/queryReadingModifyHistory`, {
    data
  });
};

//水量统计 查询修正历史记录
export const queryStatisticsModifyHistory = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/queryStatisticsModifyHistory`, {
    data
  });
};

//提交记录 查询
export const balancequerySubmitHistory = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/querySubmitHistory`, {
    data
  });
};

//水量统计 查询
export const balancequeryStatisticsList = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/queryStatisticsList`, {
    data
  });
};

//水量统计 修正
export const balanceupdateStatistics = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/updateStatistics`, {
    data
  });
};

//水量统计 查询修正历史记录
export const balancequeryStatisticsModifyHistory = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/queryStatisticsModifyHistory`, {
    data
  });
};

//水量异常指标 spc查询
export const balancequeryWaterBalanceSpc = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/queryBalanceUnitSpc`, {
    data
  });
};

//水平衡SPCJOB 查询
export const balancequeryWaterBalanceSPCJobList = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/queryWaterBalanceSPCJobList`, {
    data
  });
};

//水平衡SPCJOB 查询
export const eventqueryBalanceNameList = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/event/queryBalanceNameList`, {
    data
  });
};

// //水平衡SPCJOB 百分比
// export const pidqueryWaterBalance = (data?: object) => {
//   return http.request<ResultTable>("post", `/operation//api/v1/pid/queryWaterBalance`, {
//     data
//   });
// };

//水平衡SPCJOB 查询
export const balancequerySubmitStatus = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/querySubmitStatus`, {
    data
  });
};

//查询水平衡
export const pidqueryWaterBalance = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/pid/queryWaterBalance`, {
    data
  });
};
//查询水平衡spcJob和告警
export const pidqueryWaterBalanceSpcWarn = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/pid/queryWaterBalanceSpcWarn`, {
    data
  });
};
//查询水平衡单元spcJob和告警
export const pidqueryWaterBalanceUnitSpcWarn = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/pid/queryWaterBalanceUnitSpcWarn`, {
    data
  });
};

//抄表记录 提交状态
export const balancequeryReadingSubmitStatus = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/water/balance/queryReadingSubmitStatus`, {
    data
  });
};

//水课-抄表修订 导入
export const balanceimportData = (data?: object | undefined, cb?: (err: any) => any) =>
  http.request<Array<TableItem>>(
    "post",
    `/operation/api/v1/water/balance/importData`,
    { data },
    { headers: { noLoading: true, "Content-Type": "multipart/form-data" } },
    cb
  );
